<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableUser extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		Schema::create('user', function($table){
			$table->bigIncrements('id');
			$table->string('name', 30);
			$table->string('phone_number', 11);
			$table->string('email');
			$table->string('registered_ip');
			$table->boolean('active')->default(0);
			$table->bigInteger('group')->unsigned();
			$table->rememberToken();
			$table->timestamps();
			$table->softDeletes();

			$table->unique('email');
			$table->index('email');

			$table->foreign('group')->references('id')->on('user_group');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}

}
